<!doctype html>
<html>
<head>
    <style>
        * {
            margin:0;
            padding: 0;
        }
        .header {
            background: -webkit-linear-gradient(left, #00d6ff , #008aff); /* Safari 5.1 - 6.0 */
            background: -o-linear-gradient(right, #00d6ff , #008aff); /* Opera 11.1 - 12.0 */
            background: -moz-linear-gradient(right, #00d6ff , #008aff); /* Firefox 3.6 - 15 */
            background: linear-gradient(to right, #00d6ff , #008aff); /* 标准的语法 */
        }
    </style>
</head>
<body>
    <div class="header" id="header"></div>
</body>
</html>
<!-- util -->
<script src="util/mm.js"></script>
<script src="script/constants.js"></script>
<script type="text/javascript">
    var init = function() {
        var el = document.getElementById("header");
        el.style.height = api.safeArea.top + "px";

        var currUser = mm.getStorage($C.currUser);
        if(!currUser) {
            openFrame("html/login/login.html", "main")
        } else {
            openFrame("html/main/main.html", "login")
        }
    }
    var openFrame = function(url,name) {
        api.openFrame({
            name: name,
            url: url,
            rect: {
                x: 0,
                y: api.safeArea.top,
                w: 'auto',
                h: 'auto'
            },
            pageParam: {
                name: 'test'
            }
        });
    }

    apiready = function () {
        init()
    };
</script>